package paper.crawler;

/*
 * A class for storing links and associated information. The link can be
 * accompanied bya hopCount limit (which counts down to zero), and a
 * quality which should be bigger than zero. Links with a higher quality
 * are scheduled in preference to links with a lower quality. A link-value
 * of 1 indicates "normal" quality.
 */
public class LinkEvent implements Comparable<LinkEvent> {
    String url;
    int hopCount;
    double quality;
    public LinkEvent(String url, int hopCount, double quality) {
        this.url = url;
        this.hopCount = hopCount;
        this.quality = quality;
    }

    public int compareTo(LinkEvent x) {
        if (this.quality < x.quality) return 1; // reverse - highest one first
        if (this.quality > x.quality) return -1;// lowest one last.
        return 0;
    }
}
